package com.teamone.etl.apimanager.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.teamone.etl.apimanager.dao.ApiRuleDao;
import com.teamone.etl.apimanager.entity.ApiRule;
import com.teamone.etl.apimanager.request.BaseQuery;
import com.teamone.etl.apimanager.service.ApiRuleService;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 接口规则表(ApiRule)表服务实现类
 *
 * @author makejava
 * @since 2021-01-20 18:32:05
 */
@Service("apiRuleService")
@Transactional(rollbackFor = Exception.class)
public class ApiRuleServiceImpl extends ServiceImpl<ApiRuleDao, ApiRule> implements ApiRuleService {

    @Override
    public PageInfo<ApiRule> selectAll(BaseQuery baseQuery) {
        PageHelper.startPage(baseQuery.getPageNum(), baseQuery.getPageSize());
        List<ApiRule> apiRules=baseMapper.selectAll();
        return new PageInfo<>(apiRules);
    }

    @Override
    public void logicDeleteById(Integer id) {
        baseMapper.logicDeleteById(id);
    }

    @Override
    public void changeState(Integer id, Integer state) {
        baseMapper.changeState(id,state);
    }

    @Override
    public void saveOne(ApiRule apiRule) {
        baseMapper.saveOne(apiRule);
    }

    @Override
    public void updateOne(ApiRule apiRule) {
        baseMapper.updateOne(apiRule);
    }
}